]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensionSystem: Handle all initExtension() extension errors
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 17 May 2017 22:03:28 +0000 (00:03 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 17 Jul 2017 11:03:19 +0000 (13:03 +0200)
The method currently catches errors that occur when calling the
extension's init() method, but throws itself an error if the
expected extension.js file is missing. The former is pointless
if we expect all callers to handle errors themselves anyway, and
we should avoid the latter if we don't - opt for the second option
and handle a missing extension.js file gracefully.

https://bugzilla.gnome.org/show_bug.cgi?id=781728

js/ui/extensionSystem.js

index f25d63ae85f0b3fac8ab58b3610771e57359b5ca..cf501da82d32b6f260f803b208983ae314f265ac 100644 (file)
@@ -218,8 +218,10 @@ function initExtension(uuid) {
         throw new Error("Extension was not properly created. Call loadExtension first");
 
     let extensionJs = dir.get_child('extension.js');
-    if (!extensionJs.query_exists(null))
-        throw new Error('Missing extension.js');
+    if (!extensionJs.query_exists(null)) {
+        logExtensionError(uuid, new Error('Missing extension.js'));
+        return false;
+    }
 
     let extensionModule;
     let extensionState = null;